package com.training.food.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.training.food.Mapper.WSmarketMapper;
import com.training.food.pojo.Initialpur;
import com.training.food.pojo.WSmarket;
import com.training.food.service.WSmarketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WSmarketServiceImpl extends ServiceImpl<WSmarketMapper, WSmarket> implements WSmarketService {
    @Autowired
    WSmarketMapper wsmarketMapper;
    @Override
    public Integer add(WSmarket wsmarket) {
         wsmarketMapper.insert(wsmarket);
        return wsmarket.getWSmarketId();
    }

    @Override
    public void sub(WSmarket wsmarket) {
        wsmarketMapper.delete(wsmarket);

    }

    @Override
    public boolean select(WSmarket wsmarket) {
        if(wsmarketMapper.select(wsmarket)!=null)return true;
        return false;
    }

    @Override
    public void update(WSmarket wsmarket) {
        wsmarketMapper.update(wsmarket);
    }

    @Override
    public List<WSmarket> thelist(List<Initialpur> list) {
        return wsmarketMapper.thelist(list);
    }

    @Override
    public List<WSmarket> selectByUser(String username, String state) {
        //System.out.println(wsmarketMapper.selectByUser(username,state,"*"));
        return wsmarketMapper.selectByUser(username,state,"*");
    }

    @Override
    public List<WSmarket> selectAll(WSmarket wsmarket) {
        return wsmarketMapper.selectAll(wsmarket.getState());
    }

    @Override
    public List<WSmarket> selectByNull() {
        List<WSmarket>lists=wsmarketMapper.selectAllByNULL("*");
        System.out.println(lists);
        return lists;
    }
}
